Release 10.1A: OpenEdge Development:
Progress 4GL Reference
READ-XMLSCHEMA( ) method
Reads XML Schema from an XML document and uses that schema to either create a schema for a ProDataSet or temp-table object, or verify existing schema in a ProDataSet, temp-table, or temp-table buffer object. The XML document must be an XML Schema written in the XML Schema Definition (XSD) language in the 2001 XML Schema namespace (http://www.w3.org/2001/XMLSchema).
Return type: LOGICAL Applies to: Buffer object handle, ProDataSet object handle, Temp-table object handle
source-typeA CHARACTER expression that specifies the source XML document type. Valid values are: “FILE”, “MEMPTR”, “HANDLE”, and “LONGCHAR”.
fileA CHARACTER expression that specifies the name of an XML Schema file. You can specify an absolute pathname, a relative pathname (based on the current working directory), or a URL pathname. Valid URL protocols include FILE and HTTP (the HTTPS protocol is not supported). Progress verifies that the file exists and is accessible.
memptrA MEMPTR variable that contains the XML Schema document text. The size of the MEMPTR variable must match the size of the XML document text.
handleA WEB-CONTEXT system handle, X-document object handle, or X-noderef object handle.
For a WEB-CONTEXT system handle, the READ-XMLSCHEMA( ) method reads an XML Schema document from the WebSpeed transaction server. The method verifies that the XML document was posted to the WebSpeed transaction server (that is, the value of the IS-XML attribute for the handle is YES), and that Progress is running in a WebSpeed environment.
longcharA LONGCHAR variable that contains the XML Schema document text in memory.
override-default-mappingA LOGICAL expression where TRUE directs Progress to override the default mapping between XML Schema string and binary data types and Progress data types when creating a Progress temp-table schema from an XML Schema. The default value is FALSE.
The XML Schema string data type maps to the Progress CHARACTER data type by default, and the XML Schema base64Binary and hexBinary data types map to the Progress RAW data type by default. If you specify TRUE, the READ-XMLSCHEMA( ) method creates a temp-table schema with CLOB and BLOB fields instead of CHARACTER and RAW fields.
If you specify the Unknown value (
?), the method uses the default value of FALSE.field-type-mappingAn optional CHARACTER expression that evaluates to a comma-separated list of field name, data type pairs using the following syntax:
This option allows you to specify the Progress data type for a specific field from the XML Schema.
field-nameA CHARACTER expression that evaluates to the name of the specified field. For a ProDataSet object, you must qualify the field name with the buffer name from the XML Schema. That is,
buffer-name.field-name.data-typeA CHARACTER expression that evaluates to the data type of the specified field. The data type must be a valid Progress data type, and it must be compatible with the XML Schema type based on the Progress XML data type mapping rules. For example, any XML Schema type can be mapped to a Progress CHAR or CLOB, but an XML Schema dateTime can be mapped only to a Progress DATE, DATETIME or DATETIME-TZ.
If you specify the Unknown value (
?), the method uses the default data type. For more information about the Progress XML data type mapping rules, see OpenEdge Development: Programming Interfaces .verify-schema-modeAn optional CHARACTER expression that specifies the mode in which the READ-XMLSCHEMA( ) method verifies any XML Schema against existing Progress schema. The expression must evaluate to “LOOSE” or “STRICT”. The default value is “LOOSE”.
Note: For a dynamic temp-table or ProDataSet member buffer that does not have Progress schema (that is, the object is in the CLEAR state), this option is ignored.Table 80 lists the READ-XMLSCHEMA( ) method schema verification modes.
If you specify the Unknown value (
?), the method uses the default value of LOOSE.If the XML Schema verification fails, the method generates an error message indicating the XML Schema element that caused the failure and returns FALSE.
ExamplesThe following code example verifies the schema in a static ProDataSet object, in STRICT mode, using the schema defined in the specified XML Schema file:
The following code example creates a dynamic temp-table object, creates the object’s schema from the specified XML Schema file, and overrides the default data type mapping of one field:
Notes
- If the ProDataSet or temp-table object does not have a schema (that is, the object is dynamic and in the CLEAR state), Progress creates the schema from the XML Schema defined in the XML Schema document.
If the ProDataSet or temp-table object already has a schema (that is, the object is static, or the temp-tables are in the PREPARED state), Progress verifies the XML Schema defined in the XML Schema document against the object’s schema.
If a dynamic temp-table is not in the PREPARED or CLEAR state, the method generates an error and returns FALSE.
For more information about creating schema from XML Schema or verifying XML Schema, see OpenEdge Development: Programming Interfaces .
- You cannot create schema for a temp-table buffer or a database buffer.
See also
IS-XML attribute, READ-XML( ) method, WEB-CONTEXT system handle, WRITE-XML( ) method, WRITE-XMLSCHEMA( ) method, X-document object handle, X-noderef object handle
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |